package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.ClazzCountData;
import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {
    /**
     * 条件查找学生信息
     *
     * @param studentQueryParam
     * @return
     */
    Page<Student> selectPage(StudentQueryParam studentQueryParam);


    /**
     * 新增学员
     *
     * @param student
     * @return
     */
    int insert(Student student);

    /**
     * 修改学员
     *
     * @param student
     * @return
     */
    int update(Student student);

    /**
     * 根据id查询学员
     *
     * @param id
     * @return
     */
    Student selectById(Integer id);

    int deleteByIds(List<Integer> ids);

    int violation(@Param("id") Integer id, @Param("violationScore") short score);


    List<ClazzCountData> countStudentClazzData();

    @MapKey("name")
    List<Map<String, Object>> countStudentDegreeData();
}
